//
//  ButtonView.m
//  Traveling
//
//  Created by lanou3g on 16/3/23.
//  Copyright © 2016年 lanou3g. All rights reserved.
//

#import "ButtonView.h"

@implementation ButtonView

- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        [self initLayOut] ;
    }
    return self ;
}

- (void)initLayOut{
    
    self.scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)] ;
    self.scrollView.backgroundColor = [UIColor whiteColor] ;
    self.scrollView.contentSize = CGSizeMake(self.frame.size.width * 2, 0) ;
    self.scrollView.pagingEnabled = YES ;
    self.scrollView.bounces = NO ;
    [self addSubview:self.scrollView] ;
    
    
    //    初始化两个view,并将其放在scrollView上
    self.aView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)] ;
    self.aView.backgroundColor = [UIColor orangeColor] ;
    [self.scrollView addSubview:self.aView] ;
    
    self.bView = [[UIView alloc]initWithFrame:CGRectMake(self.frame.size.width, 0, self.frame.size.width, self.frame.size.height)] ;
    self.bView.backgroundColor = [UIColor orangeColor] ;
    [self.scrollView addSubview:self.bView] ;
    
    
    
    //    各个按钮布局
    self.aButton = [[UIButton alloc]initWithFrame:CGRectMake(40, 10, 80 , 40)] ;
    self.aButton.backgroundColor = [UIColor cyanColor] ;
    [self.aButton setTitle:@"景点门票" forState:UIControlStateNormal] ;
    [self.aView addSubview:self.aButton] ;
    
    self.bButton = [[UIButton alloc]initWithFrame:CGRectMake(self.frame.size.width / 2 - 40, 10, 80, 40)] ;
    self.bButton.backgroundColor = [UIColor cyanColor] ;
    [self.bButton setTitle:@"酒店" forState:UIControlStateNormal] ;
    [self.aView addSubview:self.bButton] ;
    
    self.cButton = [[UIButton alloc]initWithFrame:CGRectMake(self.frame.size.width - 120, 10, 80, 40)] ;
    self.cButton.backgroundColor = [UIColor cyanColor] ;
    [self.cButton setTitle:@"自由行" forState:UIControlStateNormal] ;
    [self.aView addSubview:self.cButton] ;
    
    self.dButton = [[UIButton alloc]initWithFrame:CGRectMake(40, 60, 80, 40)] ;
    self.dButton.backgroundColor = [UIColor cyanColor] ;
    [self.dButton setTitle:@"当地游" forState:UIControlStateNormal] ;
    [self.aView addSubview:self.dButton] ;
    
    self.eButton = [[UIButton alloc]initWithFrame:CGRectMake(self.frame.size.width / 2 - 40, 60, 80, 40)] ;
    self.eButton.backgroundColor = [UIColor cyanColor] ;
    [self.eButton setTitle:@"火车票" forState:UIControlStateNormal] ;
    [self.aView addSubview:self.eButton] ;
    
    self.fButton = [[UIButton alloc]initWithFrame:CGRectMake(self.frame.size.width - 120, 60, 80, 40)] ;
    self.fButton.backgroundColor = [UIColor cyanColor] ;
    [self.fButton setTitle:@"飞机票" forState:UIControlStateNormal] ;
    [self.aView addSubview:self.fButton] ;
    
    
    
    
}


@end
